<template>
  <div>
    <q-preview :templateData="templateData" :isPc="isPc" v-if="isLoad"></q-preview>
    <div v-else>
      <a-skeleton active v-for="item in 3" :key="item"/>
    </div>
  </div>
</template>

<script>
import Preview from './components/preview'
import Api from '@/services/commonApi'
export default {
  data() {
    return {
      templateData: {},
      isPc: true,
      isLoad: false,
    }
  },
  components: {
    'q-preview': Preview
  },
  created() {
    const templeteId = this.$route.query.id
    this.getTemplete(templeteId)
  },
  methods: {

    /**
     * @Description: 根据模板id获取模板数据
     * @param {*}
     * @Date: 2020-11-02 09:16:44
     */    

    getTemplete(val) {
      Api.getById('app/center/inner/template/getTemplateById',val).then(res => {
        let templateData = res.data.data
        this.$route.query.userId ? templateData.userId = this.$route.query.userId : null
        this.templateData = templateData
        this.isLoad = true
      })
    },


  }
}
</script>

<style lang="less">
  
</style>